<template>
  <div class="remark">
    <div class="remarks">
      <div class="quick_remark">
        <h5>快速备注</h5>
        <ul>
          <li>
            <span @click="selectcon($event,1)"
                  :class="{'select':selectindex == 1}">不要辣</span>
            <span @click="selectcon($event,2)"
                  :class="{'select':selectindex == 2}">少点辣</span>
            <span @click="selectcon($event,3)"
                  :class="{'select':selectindex == 3}">多点辣</span>
          </li>
          <li>
            <span @click="btncon($event,4)"
                  :class="{'select':btnindex == 4}">不要香菜</span>
          </li>
          <li>
            <span @click="onion($event,5)"
                  :class="{'select':onionindex == 5}">不要洋葱</span>
          </li>
          <li>
            <span @click="cucon($event,6)"
                  :class="{'select':cuindex == 6}">多点醋</span>
          </li>
          <li>
            <span @click="greencon($event,7)"
                  :class="{'select':greenindex == 7}">多点葱</span>
          </li>
          <li>
            <span @click="icecon($event,8)"
                  :class="{'select':iceindex == 8}">去冰</span>
            <span @click="icecon($event,9)"
                  :class="{'select':iceindex == 9}">少冰</span>
          </li>
        </ul>
      </div>
      <div class="input_remark">
        <h5>其他备注</h5>
        <textarea placeholder="请输入备注内容（可不填）"></textarea>
      </div>
      <div class="determine"
           @click="commitAction">确定</div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'OrderRemarks',
  data: function () {
    return {
      selectindex: 0,
      btnindex: 0,
      onionindex: 0,
      cuindex: 0,
      greenindex: 0,
      iceindex: 0,
    }
  },
  methods: {
    selectcon ($event, n) {
      // console.log($event)
      this.selectindex = n;
      // console.log($event.target.innerText);
      localStorage.setItem('spicy', $event.target.innerText);
    },
    btncon ($event, n) {
      this.btnindex = n;
      // console.log($event.target.innerText);
      localStorage.setItem('xiang', $event.target.innerText);
    },
    onion ($event, n) {
      this.onionindex = n;
      // console.log($event.target.innerText);
      localStorage.setItem('onion', $event.target.innerText);
    },
    cucon ($event, n) {
      this.cuindex = n;
      // console.log($event.target.innerText);
      localStorage.setItem('cu', $event.target.innerText);
    },
    greencon ($event, n) {
      this.greenindex = n;
      // console.log($event.target.innerText);
      localStorage.setItem('green', $event.target.innerText);
    },
    icecon ($event, n) {
      this.iceindex = n;
      // console.log($event.target.innerText);
      localStorage.setItem('ice', $event.target.innerText);
    },
    commitAction () {
      this.$router.push({ name: 'Confirm' });
    }
  },

}
</script>

<style lang="less">
body {
  background-color: #f5f5f5;
}

.remarks {
  margin-top: 10px;
  margin-bottom: 10px;

  .quick_remark,
  .input_remark {
    padding: 10px 14px 23px;
    background-color: white;
    margin-bottom: 10px;
    textarea {
      width: 100%;
      background-color: #f9f9f9;
      border: 0.1px solid #eee;
      resize: none;
      min-height: 100px;
      font-size: 16px;
      padding: 11px;
      box-sizing: border-box;
    }

    h5 {
      font-size: 15px;
      color: #333;
      font-weight: normal;
      margin-bottom: 10px;
    }
    ul {
      display: flex;
      flex-wrap: wrap;
      li {
        margin: 0 14px 14px 0;
        span {
          font-size: 14px;
          color: #333;
          padding: 7px 14px;
          border: 0.1px solid #3190e8;
          border-radius: 5px;
        }
        .select {
          color: white;
          background-color: #3190e8;
        }
      }
    }
  }
  .determine {
    background-color: #4cd964;
    font-size: 16px;
    color: white;
    margin: 0 16px;
    text-align: center;
    line-height: 40px;
    border-radius: 5px;
  }
}
</style>